<template>
  <el-tabs v-model="activeName" class="demo-tabs" v-if="showTable">
    <el-tab-pane label="门店" name="first">
      <StoreOrderIndex ref="storeOrderIndexRef" />
    </el-tab-pane>
    <el-tab-pane label="到家" name="second">
      <HomeOrderIndex ref="homeOrderIndexRef"
    /></el-tab-pane>
  </el-tabs>
  <StoreOrderIndex ref="storeOrderIndexRef" v-if="showStore" />
  <HomeOrderIndex ref="homeOrderIndexRef" v-if="showHome" />
</template>

<script setup lang="ts">
import { dateFormatter } from '@/utils/formatTime'
import download from '@/utils/download'
import HomeOrderIndex from './homeOrderIndex.vue'
import StoreOrderIndex from './storeOrderIndex.vue'
import * as UserApi from '@/api/system/user'
defineOptions({ name: 'OrderRefund' })

const message = useMessage() // 消息弹窗
const { t } = useI18n() // 国际化
const activeName = ref('first')
const homeOrderIndexRef = ref()
const storeOrderIndexRef = ref()
const showTable = ref(false)
const showStore = ref(false)
const showHome = ref(false)
const getDept = async () => {
  const dept = await UserApi.getCurrentDept()
  if ('manage' == dept || 'finance' == dept) {
    showTable.value = true
  } else if ('store' == dept) {
    showStore.value = true
  } else if ('home' == dept) {
    showHome.value = true
  }
}
/** 初始化 **/
onMounted(() => {
  getDept()
})
</script>
